package com.ygg.controller;


import com.ygg.model.hosp.Schedule;
import com.ygg.result.Result;
import com.ygg.service.ScheduleService;
import com.ygg.vo.hosp.ScheduleQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Api(tags = "排班接口")
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Resource
    private ScheduleService scheduleService;

    @PostMapping("/getRuleSchedule/{page}/{limit}")
    public Result<Map<String, Object>> getRuleSchedule(@RequestBody ScheduleQueryVo vo,
                                                       @PathVariable Integer page,
                                                       @PathVariable Integer limit) {
        Map<String, Object> map = scheduleService.getRuleSchedule(vo, page, limit);
        return Result.ok(map);
    }

    //根据医院编号 、科室编号和工作日期，查询排班详细信息
    @ApiOperation(value = "查询排班详细信息")
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail( @PathVariable String hoscode,
                                     @PathVariable String depcode,
                                     @PathVariable String workDate) {
        List<Schedule> list = scheduleService.getDetailSchedule(hoscode,depcode,workDate);
        return Result.ok(list);
    }





}
